package org.example;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Panel_2 extends JPanel implements ActionListener {
    private Container contentP;
    private JButton safe;

    private JButton set;

    private JButton login;

    public Panel_2(Container contentP) {
        this.addContent();
        this.contentP = contentP;
    }

    private void addContent() {


        this.setLayout(null);
        /**
         * 安全检查
         */
        this.safe = new JButton();
        this.safe.setText("安全检查");
        this.safe.setBounds(25, 10, 100, 25);
        this.add(this.safe);
        /**
         * 设置
         */
        this.set = new JButton();
        this.set.setText("设置⬇");
        this.set.setBounds(130, 10, 75, 25);
        this.set.addActionListener(this);
        this.add(this.set);
        /**
         * 登录按钮
         */
        this.login = new JButton();
        this.login.setText("登录");
        this.login.setBounds(245, 10, 60, 25);
        this.add(this.login);

    }

    @Override
    public void actionPerformed(ActionEvent e) {
        JButton jbt = (JButton) e.getSource();
        if (jbt.getText().equals("设置⬇")) {
            this.contentP.setSize(320, 570);
            jbt.setText("设置⬆");
        } else {
            jbt.setText("设置⬇");
            this.contentP.setSize(320, 240);
        }
    }
}
